<%--
  Created by IntelliJ IDEA.
  User: OS
  Date: 2018/5/21
  Time: 13:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--<script type="text/javascript" src="<c:url value='/resource/js/jquery-1.11.0.min.js'/>"></script>--%>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div class="pageContent">
    <form rel="pageForm" onsubmit="return iframeCallback(this,callbackForSubmit)"
          action="<c:url value='/danger/wzzj/editWzzjform'/>" method="post"
          enctype="multipart/form-data" class="pageForm required-validate">
        <input type="hidden" value="${wzzj.id}" name="id"/>
        <input type="hidden" value="2" name="type"/>
        <div class="pageFormContent" layouth="56" style="height: 473px; overflow: auto;">
            <p style="width: 250px;">
                <label style="width: 100px;">区：</label>
                <select class="combox required" name="fjid" ref="two33" refUrl="<c:url value="/danger/jl"/>?fjid={value}" >
                    <option value="" <c:if test="${wzzj.fjid eq '' || wzzj.fjid eq null}">selected</c:if>>请选择</option>
                    <c:forEach var="dicone" items="${dicone}">
                        <option value="${dicone.id}" <c:if test="${dicone.id eq wzzj.fjid}">selected</c:if>>${dicone.name}</option>
                    </c:forEach>
                </select><span style="color: red;font-weight: 800;font-size: 16px;">*</span>
            </p>
            <p style="width: 250px;">
                <label style="width: 100px;"> 街道：</label>
                <select class="combox required" name="pcsid" id="two33" ref="three33" refUrl="<c:url value="/danger/jl"/>?pcsid={value}" >
                    <option value="" <c:if test="${wzzj.pcsid eq '' || wzzj.pcsid eq null}">selected</c:if>>请选择</option>
                    <c:forEach var="dictwo" items="${dictwo}">
                        <option value="${dictwo.id}" <c:if test="${dictwo.id eq wzzj.pcsid}">selected</c:if>>${dictwo.name}</option>
                    </c:forEach>
                </select><span style="color: red;font-weight: 800;font-size: 16px;">*</span>
            </p>
            <p style="width: 250px;">
                <label style="width: 100px;"> 社区：</label>
                <select class="combox required" name="sqid" id="three33">
                    <option value="" <c:if test="${wzzj.sqid eq '' || wzzj.sqid eq null}">selected</c:if>>请选择</option>
                    <c:forEach var="dicthree" items="${dicthree}">
                        <option value="${dicthree.id}" <c:if test="${dicthree.id eq wzzj.sqid}">selected</c:if>>${dicthree.name}</option>
                    </c:forEach>
                </select><span style="color: red;font-weight: 800;font-size: 16px;">*</span>
            </p>
            <p>
                <label style="width: 100px;"> 时间：</label>
                <input type="text" readonly="readonly" <c:if test="${wzzj.id!=null&&wzzj.id!=''}"> value="<fmt:formatDate value="${wzzj.ytsj}" pattern="yyyy-MM-dd"/>"</c:if>
                       class="date required" maxDate="{%y}-%M-{%d}"  name="ytsj" id="ytsj" dateFmt="yyyy-MM-dd" size="30"/>
            </p>
            <p>
                <label style="width: 100px;">负责人姓名：</label>
                <input type="text" size="30" class="textInput required" name="fzrxm" <c:if test="${wzzj.id!=null&&wzzj.id!=''}"> value="${wzzj.fzrxm}" </c:if>/>
            </p>
            <p>
                <label style="width: 100px;">负责人职务：</label>
                <input type="text" size="30" class="textInput required" name="fzrzw" <c:if test="${wzzj.id!=null&&wzzj.id!=''}"> value="${wzzj.fzrzw}" </c:if>/>
            </p>
            <p>
                <label style="width: 100px;">追究事由：</label>
                <input type="text" size="30" class="textInput required" name="ytsy" <c:if test="${wzzj.id!=null&&wzzj.id!=''}"> value="${wzzj.ytsy}" </c:if>/>
            </p>
            <p>
                <label style="width: 100px;">追究内容：</label>
                <input type="text" size="30" class="textInput required" name="ytnr" <c:if test="${wzzj.id!=null&&wzzj.id!=''}"> value="${wzzj.ytnr}" </c:if>/>
            </p>
            <p>
                <label style="width: 100px;">追究人数：</label>
                <input type="text" size="30" class="textInput required" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9]+/,'');}).call(this)" onblur="this.v();" name="ytrs" <c:if test="${wzzj.id!=null&&wzzj.id!=''}">value="${wzzj.ytrs}"</c:if>/>
            </p>
            <p>
                <label style="width: 100px;">追究责任：</label>
                <input type="text" size="30" class="textInput required" name="zrzj" <c:if test="${wzzj.id!=null&&wzzj.id!=''}">value="${wzzj.zrzj}"</c:if>/>
            </p>
            <table>
                <c:forEach begin="0" end="2" varStatus="status">
                    <tr>
                        <td>
                            <c:if test="${status.index==0}"><label style="width: 100px;">约谈照片：</label></c:if>
                        </td>
                        <td>
                            <c:choose>
                                <c:when test="${photoList[status.index] == null || photoList[status.index] == '' }">
                                    <input type="file" name="file" accept="image/*"/>
                                </c:when>
                                <c:otherwise>
                                    <div style="border:1px solid #f0f0f0;float: left;margin:0px 4px 0 0; position: relative;">
                                        <img src="${photoList[status.index].fastUrl}" style="width:55px;height: 55px;"/>
                                <span style="width: 12px;height: 12px;line-height: 12px; position:absolute;
                                right: -1px;top: -1px;color: #fff;background: #ff0000;cursor: pointer; border-radius: 100%;
                                text-align: center; " class="cha" val="${photoList[status.index].id}">×</span>
                                    </div>
                                    <input type="file" name="file" accept="image/*" style="display: none;"/>
                                </c:otherwise>
                            </c:choose>
                        </td>
                    </tr>
                </c:forEach>
            </table>
        </div>
        <div class="formBar">
            <ul>
                <li><div class="buttonActive"><div class="buttonContent"><button id="bc" type="submit">保存</button></div></div></li>
                <li>
                    <div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
                </li>
            </ul>
        </div>
    </form>
</div>

<script type="text/javascript">
    function callbackForSubmit(resp, st, xhr) {
        if (resp && resp.succ) {
            alertMsg.info(resp.msg);
            $.pdialog.closeCurrent();
            // $.pdialog.close("page_per_party_deteil");
            navTab.reloadFlag('page_zz_index');
        } else {
            alertMsg.info(resp.msg);
        }
    }

    $(".cha").click(function(){
        var obj = $(this);
        var id = obj.attr("val");
        $.ajax({
            type: "post",
            dataType: "json",
            url:"<c:url value='/danger/wzzj/deletePic'/>?id="+id,
            success: function (data) {
                if(data.succ){
                    obj.parent().next("input[type=file]").show();
                    obj.parent().remove();
                }else{
                    alertMsg.info(data.msg);
                }
            },
            error: function () {
                alertMsg.info(data.msg);
            }
        });
    });
</script>
</body>
</html>